import { MAX_FONT_SIZE, PC_DEVICE_WIDTH } from '~/constants/index'

const { width } = useWindowSize()

export const isMobileTerminal = computed<boolean>(() => {
  return width.value < PC_DEVICE_WIDTH
})

export const useRem = () => {
  document.addEventListener('DOMContentLoaded', () => {
    const html: HTMLHtmlElement = document.querySelector('html')!
    let fontSize = window.innerWidth / 10
    fontSize = fontSize > MAX_FONT_SIZE ? MAX_FONT_SIZE : fontSize

    html.style.fontSize = `${fontSize}px`
  })
}
